<template>
	<view class="contacts">
		<view class="contacts-container">
			<view class="user-list">
				<view class="user-list-item" v-for="(item,index) in customers" :key="key" @click="chat(item)">
					<view class="user-item-avatar">
						<image :src="item.avatar"></image>
					</view>
					<view class="user-item-info">
						<text class="user-item-info__name">{{item.name}}</text>
					</view>
				</view>
			</view>
		</view>
		<u-tabbar v-model="current" :list="tabbarListlLawyer" :border-top="false" inactive-color="#C8C8C8"
			@change="handleTabbar" :is-back="false" />
	</view>
</template>

<script>
	import {
		tabbarListlLawyer,
	} from '@/utils/common.js';
	export default {
		data() {
			return {
				tabbarListlLawyer,
				current: 1,
				customers: [],
			};
		},
		onShow() {
			this.initData()
		},
		methods: {
			handleTabbar(index) {
				let url = ['/pages/conversations/conversations', '/pages/customers/customers', '/pages/my/my']
				uni.reLaunch({
					url: url[index]
				})
			},
			chat(item) {
				//进入私聊
				uni.navigateTo({
					url: '/pages/serviceChat/serviceChat?to=' + JSON.stringify(item)
				});
			},
			initData() {
				this.$u.api._kulist().then(res => {
					this.customers = res.data;
				})
			}
		},
	}
</script>
<style>
	page {
		width: 100%;
		height: 100%;
		font-family: Source Han Sans CN;
	}
</style>
<style lang="scss" scoped>
	.contacts {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
	}

	.contacts .contacts-container {
		width: 100%;
		overflow: auto;
	}

	.contacts .user-list-item {
		height: 132rpx;
		padding-left: 32rpx;
		display: flex;
		align-items: center;
	}

	.contacts .contacts-title {
		height: 80rpx;
		line-height: 100rpx;
		font-size: 30rpx;
		color: #666666;
		background: #F3F4F7;
		text-indent: 44rpx;
	}

	.contacts .user-list {
		flex-grow: 1;
		background: #ffffff;
		display: flex;
		flex-direction: column;
	}

	.contacts .user-item-avatar {
		width: 96rpx;
		height: 96rpx;
		margin-right: 32rpx;
		overflow: hidden;
		position: relative;
	}

	.contacts .user-item-avatar image {
		width: 100%;
		height: 100%;
		display: block;
	}

	.contacts .user-item-info {
		height: 130rpx;
		padding-right: 32rpx;
		line-height: 88rpx;
		flex-grow: 1;
		border-bottom: 1px solid #EFEFEF;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.contacts .user-item-info__name {
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-style: normal;
		font-weight: bold;
		color: #262628;
	}

	.contacts .user-item-info__tips {
		height: 44rpx;
		width: 64rpx;
		border-radius: 24rpx;
		font-size: 26rpx;
		line-height: 44rpx;
		background: #D02129;
		color: #ffffff;
		font-family: Cabin;
		text-align: center;
	}
</style>